package model;

import java.util.List;

/**
 * Meeting mail place holder
 */
public class MeetingMail implements EmailImp, MeetingEmailImp
{
	private static final long serialVersionUID = -2034382329308307033L;
	
	private String sender = "";
    private List<String> receiver;
    private String subject = "";
    private String message = "";
    private String time = "";
    private String persistencePath = "";
    private String meetingPlace = "";
    private String startTime = "";
    private String endTime = "";  
    private String meetingId = "";
    
    /**
     * Default Constructor
     */
    public MeetingMail()
    {
    	
    }
    
    /**
     * Constructor
     * @param builder the builder (builder pattern)
     */
    public MeetingMail(Builder builder)
    {
        this.sender = builder.sender;
        this.receiver = builder.receiver;
        this.subject = builder.subject;
        this.message = builder.message;
        this.time = builder.time;
        this.startTime = builder.start;
        this.endTime = builder.end;
        this.meetingPlace = builder.place;
    }

    /**
     * The builder pattern has been used to construct 'meeting' object easily, helps to add more attributes
     * The static class Builder takes parameters for MeetingMail objects. 
     */
    public static class Builder 
    {
        private String sender;
        private List<String> receiver;
        private String subject;
        private String message;
        private String time;
        private String start;
        private String end;
        private String place;
    
        /**
         * set sender of the meeting request
         * @param sender the sender of the meeting request
         * @return builder of the Meeting mail
         */
        public Builder setSender(String sender)
        {
            this.sender = sender;
            return this;
        }
        
        /**
         * set receiver
         * @param receiver the receiver(s) of the meeting email
         * @return builder of the Meeting mail
         */
        public Builder setReceiver(List<String> receiver)
        {
            this.receiver = receiver;
            return this;
        }
        
        /**
         * set subject
         * @param subject subject of the meeting email
         * @return builder of the Meeting email
         */
        public Builder setSubject(String subject)
        {
            this.subject = subject;
            return this;
        }
        
        /**
         * set message
         * @param message message of the meeting email
         * @return builder of the Meeting mail
         */
        public Builder setMessage(String message)
        {
            this.message = message;
            return this;
        }
        
        /**
         * set time of creation
         * @param time meeting creation time
         * @return builder of the Meeting mail
         */
        public Builder setTimeOfCreation(String time)
        {
            this.time = time;
            return this;
        }
        
        /**
         * set the meeting start time
         * @param start meeting start time
         * @return builder of the Meeting mail
         */
        public Builder setStartTime(String start)
        {
            this.start = start;
            return this;
        }
        
        /**
         * set the meeting end time
         * @param end meeting end time
         * @return builder of the Meeting mail
         */
        public Builder setEndTime(String end)
        {
            this.end = end;
            return this;
        }
        
        /**
         * set the meeting place
         * @param place the meeting place
         * @return builder of the Meeting mail
         */
        public Builder setPlace(String place)
        {
            this.place = place;
            return this;
        }
        
        /**
         * to build the MeetingMail
         * @return to MeetingMail object
         */
        public MeetingMail build()
        {
            return new MeetingMail(this);
        }       
    }

    /*
     * (non-Javadoc)
     * @see model.EmailImp#getSender()
     */
    public String getSender()
    {
        return this.sender;
    }

    /*
     * (non-Javadoc)
     * @see model.EmailImp#getReceiver()
     */
    public List<String> getReceiver()
    {
        return this.receiver;
    }

    /*
     * (non-Javadoc)
     * @see model.EmailImp#getSubject()
     */
    public String getSubject()
    {
        return this.subject;
    }

    /*
     * (non-Javadoc)
     * @see model.EmailImp#getMessage()
     */
    public String getMessage()
    {
        return this.message;
    }
    
    /*
     * (non-Javadoc)
     * @see model.EmailImp#getTime()
     */
    public String getTime()
    {
        return this.time;
    }
    
    /*
     * (non-Javadoc)
     * @see model.EmailImp#setPersistencePath(java.lang.String)
     */
    public void setPersistencePath(String persistencePath)
    {
        this.persistencePath  = persistencePath;
    }

    /*
     * (non-Javadoc)
     * @see model.EmailImp#getPersistencePath()
     */
    public String getPersistencePath()
    {
        return this.persistencePath;
    }

    /*
     * (non-Javadoc)
     * @see model.MeetingEmailImp#updateMeetingPlace(java.lang.String)
     */
    public void updateMeetingPlace(String place)
    {
        this.meetingPlace = place;        
    }

    /*
     * (non-Javadoc)
     * @see model.MeetingEmailImp#updateMetingTime(java.lang.String, java.lang.String)
     */
    public void updateMetingTime(String start, String end)
    {
        this.startTime = start;
        this.endTime = end;
    }

    /*
     * (non-Javadoc)
     * @see model.MeetingEmailImp#getMeetingPlace()
     */
    public String getMeetingPlace()
    {
        return this.meetingPlace;
    }

    /*
     * (non-Javadoc)
     * @see model.MeetingEmailImp#getStartTime()
     */
    public String getStartTime()
    {
        return this.startTime;
    }

    @Override
    public String getEndTime()
    {
        return this.endTime;
    }
    
    

    /**
     * 
     * This is a method used to update the time of arrival of the email.
     * @param time takes the updated time as a string.
     */
    public void updateTime(String time)
    {
        this.time = time;
    }

    /**
     * update the subject
     * @param updateSubject the updated subject of the meeting email
     */
    public void updateSubject(String updateSubject)
    {
       this.subject = updateSubject;        
    }

    /**
     * to update the message
     * @param updateMessage the updated message of the meeting email
     */
    public void updateMessage(String updateMessage)
    {
       this.message = updateMessage;        
    }
    
    /**
     * set the meeting id
     * @param id the meeting id
     */
    public void setMeetingID(String id)
    {
        this.meetingId = id;
    }
    
    /**
     * get the meeting id
     * @return the meeting id
     */
    public String getMeetingId()
    {
        return this.meetingId;
    }

	/*
	 * (non-Javadoc)
	 * @see model.EmailImp#asString()
	 */
	public String asString() {
		
		return null;
	}
    
}
